<?php

namespace app\validate;

use think\Validate;

class TaskValidate extends Validate
{

    /**
     * @return TaskValidate
     */
    public function sceneUserCountDetail(): TaskValidate
    {
        return $this->append('user_id', 'require')
            ->append('project_id', 'require|array')
            ->append('step_category_id_list', 'require|array');
    }

    /**
     * MyResponsibleTaskList 我负责的任务-list
     * @return TaskValidate
     */
    public function sceneMyResponsibleTaskList(): TaskValidate
    {
        return $this->append([
            'project_id' => 'integer',
            'executor' => 'integer',
//            'is_my_responsible' => 'bool',
            'department_id' => 'integer',
//            'only_not_done' => 'bool',
            'start_time' => 'integer',
            'end_time' => 'integer',
        ]);
    }

    /**
     * MyResponsibleTaskCount 我负责的任务-count
     * @return TaskValidate
     */
    public function sceneMyResponsibleTaskCount(): TaskValidate
    {
        return $this->append([
            'project_id' => 'integer',
            'executor' => 'integer',
//            'is_my_responsible' => 'bool',
            'department_id' => 'integer',
//            'only_not_done' => 'bool',
            'start_time' => 'integer',
            'end_time' => 'integer',
        ]);
    }

    /**
     * Count 任务统计
     * @return TaskValidate
     */
    public function sceneCount(): TaskValidate
    {
        return $this->append([
            'project_id' => 'integer',
            'executor' => 'integer',
//            'is_my_responsible' => 'bool',
            'department_id' => 'integer',
//            'only_not_done' => 'bool',
            'start_time' => 'integer',
            'end_time' => 'integer',
        ]);
    }

    /**
     * UserList 用户列表
     * @return TaskValidate
     */
    public function sceneUserList(): TaskValidate
    {
        return $this->append([
            'project_id' => 'integer',
            'executor' => 'integer',
//            'is_my_responsible' => 'bool',
            'department_id' => 'integer',
//            'only_not_done' => 'bool',
            'start_time' => 'integer',
            'end_time' => 'integer',
        ]);
    }

    /**
     * DelayCount 延期统计
     * @return TaskValidate
     */
    public function sceneDelayCount(): TaskValidate
    {
        return $this->append([
            'project_id' => 'require|integer',
            'department_id' => 'integer',
            'start_time' => 'integer',
            'end_time' => 'integer',
            'query_range' => 'in:upstream,self,mine',
            'is_self' => 'in:yes,no',
        ]);
    }

    // DelayEpisodeList 验证场景定义
    public function sceneDelayEpisodeList()
    {
        return $this->append([
            'project_id' => 'require|integer',
            'department_id' => 'integer',
            'start_time' => 'integer',
            'end_time' => 'integer',
            'todo_step_category_id' => 'array',
            'query_range' => 'require|in:self,upstream,mine',
            'query_type' => 'require|in:yes,no',
        ]);
    }
}
